******************************************************************
***   Programmer: C. Deal                             
***   Date Created: August 10, 2021
***   Last Updated: January 25, 2024                          
***   This file replicates the result of Deal, Greenberg, Gonzales (2024)
******************************************************************

**# Loading in Data
*Tell Stata where your data are located and any files should be saved

*CHANGE THIS PATH TO THE DOWNLOADED REPLICATION FOLDER
global path "C:\Users\cdeal\Box\New Box Folder for RAs\Cameron Deal\Completed Projects\Gov Assistance HPS\replication"


use "$path\pulse2021_puf_34.dta", replace
gen wave = 34
append using "$path\pulse2021_puf_35.dta"
replace wave = 35 if wave==.
append using "$path\pulse2021_puf_36.dta"
replace wave = 36 if wave==.
append using "$path\pulse2021_puf_37.dta"
replace wave = 37 if wave==.
append using "$path\pulse2021_puf_38.dta"
replace wave = 38 if wave==.
append using "$path\pulse2021_puf_39.dta"
replace wave = 39 if wave==.
append using "$path\pulse2021_puf_40.dta"
replace wave = 40 if wave==.
append using "$path\pulse2022_puf_41.dta"
replace wave = 41 if wave==.
append using "$path\pulse2022_puf_42.dta"
replace wave = 42 if wave==.
append using "$path\pulse2022_puf_43.dta"
replace wave = 43 if wave==.
cd "$path"

**#Cleaning Data
***Primary Grouping Variables

*Gender Minority Binary
gen genderminbin = .
replace genderminbin = 0 if genid_describe!=99
replace genderminbin = 1 if genid_describe==3 & agenid_birth==2
replace genderminbin = 1 if genid_describe==1 & egenid_birth==2 & agenid_birth==2
replace genderminbin = 1 if egenid_birth==1 & genid_describe==2 & agenid_birth==2
label define genderminbin 1 "Gender Minority" 0 "Cisgender"
label values genderminbin genderminbin
label var genderminbin "Gender Minority Status"
tab genderminbin

*Sexuality Categories
gen sexualitycat=.
replace sexualitycat = 1 if sexual_orientation==2
replace sexualitycat = 2 if sexual_orientation==1
replace sexualitycat = 3 if sexual_orientation==3
label define sexualitycat 1 "Heterosexual" 2 "Gay/lesbian" 3 "Bisexual"
label values sexualitycat sexualitycat
label var sexualitycat "Sexuality Categories"
tab sexualitycat

*Bisexual dummy with heterosexual as reference
gen bisexual = .
replace bisexual = 1 if sexual_orientation==3
replace bisexual = 0 if sexual_orientation==2
label define bisexual 0 "Heterosexual" 1 "Bisexual" 
label values bisexual bisexual
label var bisexual "Bisexual Status"
tab bisexual

*Gay/Lesbian dummy with heterosexual as reference
gen gaylesbian = .
replace gaylesbian = 1 if sexual_orientation==1
replace gaylesbian = 0 if sexual_orientation==2
label define gaylesbian 0 "Heterosexual" 1 "Gay/Lesbian" 
label values gaylesbian gaylesbian
label var gaylesbian "Gay/Lesbian Status"
tab gaylesbian


***Demographics

*Sex- No Missing
gen male = 0
replace male = 1 if egenid_birth==1

gen female = 0
replace female = 1 if egenid_birth==2



*Age Continuous- No Missing
gen age = 2021 - tbirth_year
gen age_squared = age^2


*Age Categories- don't use
gen agecat = .
replace agecat = 1 if age>=18 & age<=25
replace agecat = 2 if age>=26 & age<=34
replace agecat = 3 if age>=35 & age<=49
replace agecat = 4 if age>=50 & age<=64
replace agecat = 5 if age>=65
label define agecat 1 "18-25" 2 "26-34" 3 "35-49" 4 "50-64" 5 "65+"
label values agecat agecat
label var agecat "Age Categories"
tab agecat


*Race- No Missing
gen race4 =. 
replace race4 = 1 if rrace==1
replace race4 = 2 if rrace==2
replace race4 = 3 if rrace==3
replace race4 = 4 if rrace==4
replace race4 = 5 if rhispanic==2
label define race4 1 "White, non-Hispanic" 2 "Black, non-Hispanic" 3 "Asian, non-Hispanic" 4 "All other races, non-Hispanic" 5 "Hispanic"
label values race4 race4
label var race4 "Racial Categories"
tab race4

*Relationship Status
gen relstatus =. 
replace relstatus = 1 if ms==1
replace relstatus = 2 if ms==2 | ms==3 | ms==4
replace relstatus = 3 if ms==5
replace relstatus = 4 if ms==-99
label define relstatus 1 "Married" 2 "Widowed, Divorced, or Separated" 3 "Never Married" 4 "Missing"
label values relstatus relstatus
label var relstatus "Relationship Categories"
tab relstatus

*Child Under 18 in household- no missing
gen chldpresent=. 
replace chldpresent = 1 if thhld_numkid==1 | thhld_numkid==2 | thhld_numkid==3 | thhld_numkid==4 | thhld_numkid==5
replace chldpresent = 0 if thhld_numkid==0
label define chldpresent 1 "Child in House" 0 "No Child in House"
label values chldpresent chldpresent
label var chldpresent "Child Present?"
tab chldpresent


*Educational attainment
gen educat=.
replace educat = 1 if eeduc==1 | eeduc==2
replace educat = 2 if eeduc==3
replace educat = 3 if eeduc==4 | eeduc==5
replace educat = 4 if eeduc==6 | eeduc==7
label define educat 1 "Less than High School" 2 "High School Graduate" 3 "Some College" 4 "Bachelor's or higher"
label values educat educat
label var educat "Educational Attainment"
tab educat

*Family income
gen incomecat_5 =.
replace incomecat_5 = 1 if income==1 | income==2 | income==3
replace incomecat_5 = 2 if income==4 | income==5
replace incomecat_5 = 3 if income==6
replace incomecat_5 = 4 if income==7 | income==8
replace incomecat_5 = 5 if income==-99 | income==.m
label define incomecat_5 1 "Less than $49,999" 2 "$50,000-$99,999" 3 "$100,000-$149,999" 4 "$150,0000+" 5 "Missing"
label values incomecat_5 incomecat_5
label var incomecat_5 "Income Categories"
tab incomecat_5

*Building Income Range Variables for interval regressions
*lower boundary of the range
gen income_l=.
replace income_l=. if income==1
replace income_l=25000 if income==2
replace income_l=35000 if income==3
replace income_l=50000 if income==4
replace income_l=75000 if income==5
replace income_l=100000 if income==6
replace income_l=150000 if income==7
replace income_l=200000 if income==8
tab income_l

*upper boundary of the range
gen income_u=.
replace income_u=25000 if income==1
replace income_u=34999 if income==2
replace income_u=49999 if income==3
replace income_u=74999 if income==4
replace income_u=99999 if income==5
replace income_u=149999 if income==6
replace income_u=199999 if income==7
replace income_u=. if income==8
tab income_u

*logs
gen logincome_l = log(income_l)
gen logincome_u = log(income_u)

*midpoint of income range
gen income_m=.
replace income_m=12500 if income==1
replace income_m=30000 if income==2
replace income_m=42500 if income==3
replace income_m=62500 if income==4
replace income_m=87500 if income==5
replace income_m=125000 if income==6
replace income_m=175000 if income==7
replace income_m=200000 if income==8 /* need to check 80th percentile */
tab income_m

*FPL Variable
*we want to create a variable that gives us info on whether the HH is above or 
*below the federal poverty line. We will do this in a few steps; 
*Step 1: assign everyone's Federal Poverty Threshold based on the number of kids
*		 and adults in the household. 
*Step 2: compare this threshold variable to the total HH income to create a dummy
*		 for whether the HH is above or below the poverty threshold. 
*Step 3: create a variable that gives the percentage of the federal poverty line.

*===Step 1
gen pov_thresh=.

rename thhld_numkid HH_kids
rename thhld_numper HH_total


*for HHs of one person
replace pov_thresh=13465 if HH_total==1 & HH_kids==0 & age<65
replace pov_thresh=12413 if HH_total==1 & HH_kids==0 & age>=65

*for HHs of two people 
replace pov_thresh=17331 if HH_total==2 & HH_kids==0 & age<65
replace pov_thresh=15644 if HH_total==2 & HH_kids==0 & age>=65
replace pov_thresh=17839 if HH_total==2 & HH_kids==1 & age<65
replace pov_thresh=17771 if HH_total==2 & HH_kids==1 & age>=65

*for HHs of three people 
replace pov_thresh=20244 if HH_total==3 & HH_kids==0
replace pov_thresh=20832 if HH_total==3 & HH_kids==1
replace pov_thresh=20852 if HH_total==3 & HH_kids==2

*for HHs of four people
replace pov_thresh=26695 if HH_total==4 & HH_kids==0
replace pov_thresh=27131 if HH_total==4 & HH_kids==1
replace pov_thresh=26246 if HH_total==4 & HH_kids==2
replace pov_thresh=26338 if HH_total==4 & HH_kids==3

*for HHs of five people 
replace pov_thresh=32193 if HH_total==5 & HH_kids==0
replace pov_thresh=32661 if HH_total==5 & HH_kids==1
replace pov_thresh=31661 if HH_total==5 & HH_kids==2
replace pov_thresh=38887 if HH_total==5 & HH_kids==3
replace pov_thresh=30414 if HH_total==5 & HH_kids==4

*for HHs of six people
replace pov_thresh=37027 if HH_total==6 & HH_kids==0
replace pov_thresh=37174 if HH_total==6 & HH_kids==1
replace pov_thresh=36408 if HH_total==6 & HH_kids==2
replace pov_thresh=35674 if HH_total==6 & HH_kids==3
replace pov_thresh=34582 if HH_total==6 & HH_kids==4
replace pov_thresh=33935 if HH_total==6 & HH_kids==5

*for HHs of seven people
replace pov_thresh=42605 if HH_total==7 & HH_kids==0
replace pov_thresh=42871 if HH_total==7 & HH_kids==1
replace pov_thresh=41954 if HH_total==7 & HH_kids==2
replace pov_thresh=41314 if HH_total==7 & HH_kids==3
replace pov_thresh=40124 if HH_total==7 & HH_kids==4
replace pov_thresh=38734 if HH_total==7 & HH_kids==5
replace pov_thresh=37210 if HH_total==7 & HH_kids==6

*for HHs of eight people
replace pov_thresh=47650 if HH_total==8 & HH_kids==0
replace pov_thresh=48071 if HH_total==8 & HH_kids==1
replace pov_thresh=47205 if HH_total==8 & HH_kids==2
replace pov_thresh=46447 if HH_total==8 & HH_kids==3
replace pov_thresh=45371 if HH_total==8 & HH_kids==4
replace pov_thresh=44006 if HH_total==8 & HH_kids==5
replace pov_thresh=42585 if HH_total==8 & HH_kids==6
replace pov_thresh=42224 if HH_total==8 & HH_kids==7

*for HHs of nine or more people 
replace pov_thresh=57319 if HH_total>=9 & HH_kids==0
replace pov_thresh=57597 if HH_total>=9 & HH_kids==1
replace pov_thresh=56831 if HH_total>=9 & HH_kids==2
replace pov_thresh=56188 if HH_total>=9 & HH_kids==3
replace pov_thresh=55132 if HH_total>=9 & HH_kids==4
replace pov_thresh=53679 if HH_total>=9 & HH_kids==5
replace pov_thresh=52366 if HH_total>=9 & HH_kids==6
replace pov_thresh=52040 if HH_total>=9 & HH_kids==7
replace pov_thresh=50035 if HH_total>=9 & HH_kids>=8

*make sure everyone is accounted for
tab pov_thresh

rename HH_kids thhld_numkid 
rename HH_total thhld_numper 

rename income_m income_midpoint

*===Step 2
gen belowFPL=.
replace belowFPL=1 if income_midpoint<=pov_thresh & income_midpoint!=.
replace belowFPL=0 if income_midpoint>pov_thresh & income_midpoint!=.
tab belowFPL


*===Step 3
gen percentFPL=(income_midpoint/pov_thresh)*100
sum percentFPL



*Employment status
gen employcat =.
replace employcat = 1 if anywork==1
replace employcat = 3 if rsnnowrkrv>=1 & rsnnowrkrv<=7
replace employcat = 2 if rsnnowrkrv>=8 & rsnnowrkrv<=12
replace employcat = 4 if anywork==-99 | anywork==.m | rsnnowrkrv==-99
label define employcat 1 "Employed" 2 "Unemployed" 3 "Not in Labor Force" 4 "Missing"
label values employcat employcat
label var employcat "Employment Categories"
tab employcat

*Employment Status Binary 
gen employ_bin= (employcat==1)
gen unemploy_bin=.
replace unemploy_bin=1 if employcat==2
replace unemploy_bin=0 if employcat==1 | employcat==3 | employcat==4 




*Health Insurance Status
gen hlth_ins_cat =.
replace hlth_ins_cat=1 if privhlth==1
replace hlth_ins_cat=2 if pubhlth==1
replace hlth_ins_cat = 3 if pubhlth==2 & privhlth==2
replace hlth_ins_cat=4 if pubhlth==3 & privhlth==3
label define hlth_ins_cat 1 "Private Health Insurance" 2 "Public Health Insurance" 3 "Uninsured" 4 "Missing"
label values hlth_ins_cat hlth_ins_cat
label var hlth_ins_cat "Health Insurance Categories"
tab hlth_ins_cat

*Weight- The weight variable is labeled pweight

*Urban Status
gen est_msanum= real(est_msa)
gen urban=(est_msanum!=.)

*States as factors
encode est_st, gen(state)



*Unemployment
gen unemployed=. 
replace unemployed = 0 if anywork==1
replace unemployed = 1 if rsnnowrkrv>=1 & rsnnowrkrv<=7
label define unemployed_label 0 "Employed" 1 "Unemployed"
label values unemployed unemployed_label
label var unemployed "Unemployment Status"
tab unemployed


*****Government Assistance Receipt

*CTC Receipt
gen childcredit= ctc_yn
replace childcredit = . if childcredit==-99
replace childcredit = 0 if childcredit==2
label define childcredit_label 0 "No Credit" 1 "Received Credit"
label values childcredit childcredit_label
label var childcredit "Child Tax Credit"
tab childcredit

*Financial Hardship- scale from 0 to 3
gen difficulty = expns_dif - 1
replace difficulty = . if difficulty==-100
label var difficulty "Difficulty with Expenses"
tab difficulty

*Financial Hardship Dummy
gen difficulty_bin=.
replace difficulty_bin = 1 if difficulty==2 | difficulty==3
replace difficulty_bin = 0 if difficulty==0 | difficulty==1
tab difficulty_bin

*Unemployment Insurance
gen uireceipt = spnd_src5
replace uireceipt = 0 if uireceipt==-99
label define uireceipt_label 0 "No Receipt" 1 "Received UI"
label values uireceipt uireceipt_label
label var uireceipt "Unemployment Insurance"
tab uireceipt

*Stimulus Payment
gen stimreceipt = spnd_src6
replace stimreceipt = 0 if stimreceipt==-99
label define stimreceipt_label 0 "No Receipt" 1 "Received Stimulus Payments"
label values stimreceipt stimreceipt_label
label var stimreceipt "Stimulus Payment"
tab stimreceipt

*Child Tax Credit for spending
gen ctcspend = spnd_src7
replace ctcspend = 0 if ctcspend==-99
label define ctcspend_label 0 "No Receipt" 1 "Received CTC"
label values ctcspend ctcspend_label
label var ctcspend "Child Tax Credit use for spending"
tab ctcspend


*SNAP utilization
gen snapspend = spnd_src9
replace snapspend = 0 if snapspend==-99
label define snapspend_label 0 "No Receipt" 1 "Received SNAP"
label values snapspend snapspend_label
label var snapspend "SNAP spending"
tab snapspend

*SNAP Receipt
gen snapreceived = (snap_yn==1)
replace snapreceived=. if snap_yn==-99

*School Meal Debit/EBT Cards
gen schoolcard = spnd_src10
replace schoolcard = 0 if schoolcard==-99
label define schoolcard_label 0 "No Receipt" 1 "Received School Meal Card"
label values schoolcard schoolcard_label
label var schoolcard "School meal card"
tab schoolcard

*Governmental Rental Assistance
gen rent_help = spnd_src11
replace rent_help = 0 if rent_help==-99
label define rent_help_label 0 "No Receipt" 1 "Received Gov. Rental Assistance"
label values rent_help rent_help_label
label var rent_help "Rental Assistance"
tab rent_help

*Medicaid
gen medicaid = hlthins4
replace medicaid = . if medicaid==-99
replace medicaid = 0 if medicaid==2
label define medicaid_label 0 "No Receipt" 1 "Received Medicaid"
label values medicaid medicaid_label
label var medicaid "Medicaid"
tab medicaid

*Job Loss Recently
gen lostjob=wrklossrv
replace lostjob=. if wrklossrv==-99
replace lostjob=0 if wrklossrv==2

*****************************************
*** Identify Sample
*****************************************
*Weights

svyset [pweight=pweight]


***************************************************************************
**#   			     ANALYSIS    			     ******************
***************************************************************************
*Globals
global demo_covariates "age age_squared i.race4 i.relstatus i.chldpresent i.male thhld_numkid i.genderminbin"
global other_covariates "i.state i.week i.urban"
global econ_covariates "i.educat i.belowFPL"
global demo_covariates_nosex "i.agecat i.race4 i.relstatus i.chldpresent"
global econ_covariates_noinc "i.educat i.employcat"

******Drop all incomplete cases
regress income_m i.sexualitycat $demo_covariates $other_covariates $econ_covariates
	gen s = 1 if e(sample)
	drop if s==.


***************************************************************************
**#   			    TABLE 1A      			     ******************
***************************************************************************
*Males:
preserve
keep if male==1
*Sexual Minorities
foreach var in race4 relstatus chldpresent educat genderminbin employcat hlth_ins_cat urban belowFPL {
tabout `var' sexualitycat using table1a.xls, cell(col se) svy stats(chi2) nlab(count) f(4) sebnone append
}

*Continuous Variables
svy: mean age, over(sexualitycat)
oneway age sexualitycat
svy: mean thhld_numkid, over(sexualitycat)
oneway thhld_numkid sexualitycat

***************************************************************************
**#   			    TABLE 2A      			     ******************
***************************************************************************

*Sexual Minorities under FPL Line
foreach var in race4 relstatus chldpresent educat genderminbin employcat hlth_ins_cat urban {
tabout `var' sexualitycat using table2a.xls if belowFPL==1, cell(col se) svy stats(chi2) nlab(count) f(4) sebnone append
}
*Continuous Variables
svy: mean age if belowFPL==1, over(sexualitycat)
oneway age sexualitycat if belowFPL==1
svy: mean thhld_numkid if belowFPL==1, over(sexualitycat)
oneway thhld_numkid sexualitycat if belowFPL==1
restore

***************************************************************************
**#   			    TABLE 1B      			     ******************
***************************************************************************

*Females:
preserve
keep if male==0
*Sexual Minorities
foreach var in race4 relstatus chldpresent educat genderminbin employcat hlth_ins_cat urban belowFPL {
tabout `var' sexualitycat using table1b.xls, cell(col se) svy stats(chi2) nlab(count) f(4) sebnone append
}

*Continuous Variables
svy: mean age, over(sexualitycat)
oneway age sexualitycat
svy: mean thhld_numkid, over(sexualitycat)
oneway thhld_numkid sexualitycat

***************************************************************************
**#   			    TABLE 2B      			     ******************
***************************************************************************

*Sexual Minorities under FPL Line
foreach var in race4 relstatus chldpresent educat genderminbin employcat hlth_ins_cat urban {
tabout `var' sexualitycat using table2b.xls if belowFPL==1, cell(col se) svy stats(chi2) nlab(count) f(4) sebnone append
}
*Continuous Variables
svy: mean age if belowFPL==1, over(sexualitycat)
oneway age sexualitycat if belowFPL==1
svy: mean thhld_numkid if belowFPL==1, over(sexualitycat)
oneway thhld_numkid sexualitycat if belowFPL==1
restore

*Basic descriptives:
tab sexualitycat male
svy: tab sexualitycat male, col
tab sexualitycat male if belowFPL==1
svy: tab sexualitycat male if belowFPL==1, col



***************************************************************************
**#   			    TABLE 3      			     ******************
***************************************************************************

***ECONOMIC STATUS
***Males
intreg logincome_l logincome_u i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1, vce(robust)
eststo log_income
regress employ_bin i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1, vce(robust)
eststo employ_bin
regress belowFPL i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1, vce(robust)
eststo belowFPL
regress difficulty_bin i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1, vce(robust)
eststo difficulty_bin
esttab using table3.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Male Economic Outcomes)       ///
   nonumbers mtitles("Log Income" "Employment" "FPL Status" "Financial Difficulty") append
eststo clear
*Means
intreg income_l income_u i.male
svy: mean employ_bin if male==1
svy: mean belowFPL if male==1
svy: mean difficulty_bin if male==1


***Females
intreg logincome_l logincome_u i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if female==1, vce(robust)
eststo log_income
regress employ_bin i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if female==1, vce(robust)
eststo employ_bin
regress belowFPL i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if female==1, vce(robust)
eststo belowFPL
regress difficulty_bin i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if female==1, vce(robust)
eststo difficulty_bin
esttab using table3.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Female Economic Outcomes)       ///
   nonumbers mtitles("Log Income" "Employment" "FPL Status" "Financial Difficulty") append
eststo clear
*Means
svy: mean employ_bin if male==0
svy: mean belowFPL if male==0
svy: mean difficulty_bin if male==0 


***************************************************************************
**#   			    TABLE 4           ******************
***************************************************************************
*heckman selection model- male subpop
heckman uireceipt i.sexualitycat $demo_covariates $other_covariates i.educ if male==1, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo uireceipt_h
heckman stimreceipt i.sexualitycat $demo_covariates $other_covariates i.educ if male==1, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo stimreceipt_h
heckman snapreceived i.sexualitycat $demo_covariates $other_covariates i.educ if male==1, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo snapreceived_h
heckman snapspend i.sexualitycat $demo_covariates $other_covariates i.educ if male==1, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo snapspend_h
heckman rent_help i.sexualitycat $demo_covariates $other_covariates i.educ  if male==1, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo rent_help_h
heckman medicaid i.sexualitycat $demo_covariates $other_covariates i.educ if male==1, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo medicaid_h

esttab using table4.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Male Receipt of Government Assistance)       ///
   nonumbers mtitles("UI Receipt" "Stimulus Receipt" "SNAP Receipt" "SNAP Utilization" "Rent Help" "Medicaid") replace
eststo clear
*means
svy: mean uireceipt if male==1
svy: mean stimreceipt if male==1
svy: mean snapreceived if male==1
svy: mean snapspend if male==1
svy: mean rent_help if male==1
svy: mean medicaid if male==1

***Females
heckman uireceipt i.sexualitycat $demo_covariates $other_covariates i.educ if male==0, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo uireceipt_h
heckman stimreceipt i.sexualitycat $demo_covariates $other_covariates i.educ if male==0, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo stimreceipt_h
heckman snapreceived i.sexualitycat $demo_covariates $other_covariates i.educ if male==0, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo snapreceived_h
heckman snapspend i.sexualitycat $demo_covariates $other_covariates i.educ if male==0, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo snapspend_h
heckman rent_help i.sexualitycat $demo_covariates $other_covariates i.educ  if male==0, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo rent_help_h
heckman medicaid i.sexualitycat $demo_covariates $other_covariates i.educ if male==0, select(belowFPL= i.sexualitycat $demo_covariates $other_covariates i.educ) twostep
eststo medicaid_h

esttab using table4.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Female Receipt of Government Assistance)       ///
   nonumbers mtitles("UI Receipt" "Stimulus Receipt" "SNAP Receipt" "SNAP Utilization" "Rent Help" "Medicaid") append
eststo clear
*means
svy: mean uireceipt if male==0
svy: mean stimreceipt if male==0
svy: mean snapreceived if male==0
svy: mean snapspend if male==0
svy: mean rent_help if male==0
svy: mean medicaid if male==0


***************************************************************************
**#  			    TABLE 5      			     ******************
***************************************************************************

***Males
regress uireceipt i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & belowFPL==1, vce(robust)
eststo uireceipt
regress stimreceipt i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & belowFPL==1, vce(robust)
eststo stimreceipt
regress snapreceived i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & belowFPL==1, vce(robust)
eststo snapreceived
regress snapspend i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & belowFPL==1, vce(robust)
eststo snapspend
regress rent_help i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & belowFPL==1, vce(robust)
eststo rent_help
regress medicaid i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & belowFPL==1, vce(robust)
eststo medicaid
esttab using table5.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Below FPL Male Receipt of Government Assistance)       ///
   nonumbers mtitles("UI Receipt" "Stimulus Receipt" "SNAP Receipt" "SNAP Utilization" "Rent Help" "Medicaid") append
eststo clear
*means
svy: mean uireceipt if male==1 & belowFPL==1
svy: mean stimreceipt if male==1 & belowFPL==1
svy: mean snapreceived if male==1 & belowFPL==1
svy: mean snapspend if male==1 & belowFPL==1
svy: mean rent_help if male==1 & belowFPL==1
svy: mean medicaid if male==1 & belowFPL==1


***Females
regress uireceipt i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & belowFPL==1, vce(robust)
eststo uireceipt
regress stimreceipt i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & belowFPL==1, vce(robust)
eststo stimreceipt
regress snapreceived i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & belowFPL==1, vce(robust)
eststo snapreceived
regress snapspend i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & belowFPL==1, vce(robust)
eststo snapspend
regress rent_help i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & belowFPL==1, vce(robust)
eststo rent_help
regress medicaid i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & belowFPL==1, vce(robust)
eststo medicaid
esttab using table5.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Below FPL Female Receipt of Government Assistance)       ///
   nonumbers mtitles("UI Receipt" "Stimulus Receipt" "SNAP Receipt" "SNAP Utilization" "Rent Help" "Medicaid") append
eststo clear
*means
svy: mean uireceipt if male==0 & belowFPL==1
svy: mean stimreceipt if male==0 & belowFPL==1
svy: mean snapreceived if male==0 & belowFPL==1
svy: mean snapspend if male==0 & belowFPL==1
svy: mean rent_help if male==0 & belowFPL==1
svy: mean medicaid if male==0 & belowFPL==1



***************************************************************************
**#   			    TABLE 6      			     ******************
***************************************************************************
**CHILD TAX CREDIT AND SCHOOL LUNCH CARD
***Males
regress childcredit i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo childcredit
regress schoolcard i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo schoolcard
regress childcredit i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & belowFPL==1, vce(robust)
eststo childcredit_fpl
regress schoolcard i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & belowFPL==1, vce(robust)
eststo schoolcard_fpl
esttab using table6.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Male Receipt of Child-Related Assistance)       ///
   nonumbers mtitles("Child Tax Credit Full" "School Lunch Card Full" "Child Tax Credit Below FPL" "School Lunch Card Below FPL") append
eststo clear
*means
svy: mean childcredit if male==1
svy: mean schoolcard if male==1
svy: mean childcredit if male==1 & belowFPL==1
svy: mean schoolcard if male==1 & belowFPL==1

***Females
regress childcredit i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo childcredit
regress schoolcard i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo schoolcard
regress childcredit i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & belowFPL==1, vce(robust)
eststo childcredit_fpl
regress schoolcard i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & belowFPL==1, vce(robust)
eststo schoolcard_fpl
esttab using table6.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Female Receipt of Child-Related Assistance)       ///
   nonumbers mtitles("Child Tax Credit Full" "School Lunch Card Full" "Child Tax Credit Below FPL" "School Lunch Card Below FPL") append
eststo clear
*means
svy: mean childcredit if male==0
svy: mean schoolcard if male==0
svy: mean childcredit if male==0 & belowFPL==1
svy: mean schoolcard if male==0 & belowFPL==1





**********************************************************************************************************


***************************************************************************
**#  			    APPENDIX TABLE 1		     ******************
***************************************************************************
*RESTRICTING TO CHILD ONLY
***Males
regress childcredit i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & chldpresent==1, vce(robust)
eststo childcredit
regress schoolcard i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & chldpresent==1, vce(robust)
eststo schoolcard
regress childcredit i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & belowFPL==1 & chldpresent==1, vce(robust)
eststo childcredit_fpl
regress schoolcard i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1 & belowFPL==1 & chldpresent==1, vce(robust)
eststo schoolcard_fpl
esttab using atable1.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Male Receipt of Child-Related Assistance with Children)       ///
   nonumbers mtitles("Child Tax Credit Full" "School Lunch Card Full" "Child Tax Credit Below FPL" "School Lunch Card Below FPL") append
eststo clear
*means
svy: mean childcredit if male==1 & chldpresent==1
svy: mean schoolcard if male==1 & chldpresent==1
svy: mean childcredit if male==1 & belowFPL==1 & chldpresent==1
svy: mean schoolcard if male==1 & belowFPL==1 & chldpresent==1

***Females
regress childcredit i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & chldpresent==1, vce(robust)
eststo childcredit
regress schoolcard i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & chldpresent==1, vce(robust)
eststo schoolcard
regress childcredit i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & belowFPL==1 & chldpresent==1, vce(robust)
eststo childcredit_fpl
regress schoolcard i.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==0 & belowFPL==1 & chldpresent==1, vce(robust)
eststo schoolcard_fpl
esttab using atable1.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Female Receipt of Child-Related Assistance with Children)       ///
   nonumbers mtitles("Child Tax Credit Full" "School Lunch Card Full" "Child Tax Credit Below FPL" "School Lunch Card Below FPL") append
eststo clear
*means
svy: mean childcredit if male==0 & chldpresent==1
svy: mean schoolcard if male==0 & chldpresent==1
svy: mean childcredit if male==0 & belowFPL==1 & chldpresent==1
svy: mean schoolcard if male==0 & belowFPL==1 & chldpresent==1




***************************************************************************
**#  			    APPENDIX TABLE 3		     ******************
***************************************************************************
*****Replicate Main Results controlling for job loss

global other_covariates "i.state i.week i.urban i.lostjob"
***Males
regress uireceipt i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo uireceipt
regress stimreceipt i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo stimreceipt
regress snapreceived i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo snapreceived
regress snapspend i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo snapspend
regress rent_help i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo rent_help
regress medicaid i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo medicaid
esttab using atable3.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Male Receipt of Government Assistance, Singles)       ///
   nonumbers mtitles("UI Receipt" "Stimulus Receipt" "SNAP Receipt" "SNAP Utilization" "Rent Help" "Medicaid") append
eststo clear


***Females
regress uireceipt i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo uireceipt
regress stimreceipt i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo stimreceipt
regress snapreceived i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo snapreceived
regress snapspend i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo snapspend
regress rent_help i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo rent_help
regress medicaid i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo medicaid
esttab using atable3.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Female Receipt of Government Assistance, Singles)       ///
   nonumbers mtitles("UI Receipt" "Stimulus Receipt" "SNAP Receipt" "SNAP Utilization" "Rent Help" "Medicaid") append
eststo clear

global other_covariates "i.state i.week i.urban"


***************************************************************************
**#   			    APPENDIX TABLE 4		     ******************
***************************************************************************
***ECONOMIC STATUS
***Males
intreg logincome_l logincome_u ib2.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1, vce(robust)
eststo log_income
regress employ_bin ib2.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1, vce(robust)
eststo employ_bin
regress belowFPL ib2.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1, vce(robust)
eststo belowFPL
regress difficulty_bin ib2.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if male==1, vce(robust)
eststo difficulty_bin
esttab using atable4.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(1.sexualitycat 3.sexualitycat) label                 ///
    title(Male Economic Outcomes)       ///
   nonumbers mtitles("Log Income" "Employment" "FPL Status" "Financial Difficulty") replace
eststo clear
*Means
intreg income_l income_u i.male
svy: mean employ_bin if male==1
svy: mean belowFPL if male==1
svy: mean difficulty_bin if male==1


***Females
intreg logincome_l logincome_u ib2.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if female==1, vce(robust)
eststo log_income
regress employ_bin ib2.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if female==1, vce(robust)
eststo employ_bin
regress belowFPL ib2.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if female==1, vce(robust)
eststo belowFPL
regress difficulty_bin ib2.sexualitycat $demo_covariates $other_covariates i.educat [pweight=pweight] if female==1, vce(robust)
eststo difficulty_bin
esttab using atable4.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(1.sexualitycat 3.sexualitycat) label                 ///
    title(Female Economic Outcomes)       ///
   nonumbers mtitles("Log Income" "Employment" "FPL Status" "Financial Difficulty") append
eststo clear
*Means
svy: mean employ_bin if male==0
svy: mean belowFPL if male==0
svy: mean difficulty_bin if male==0 

***************************************************************************
**#   			    APPENDIX TABLE 5		     ******************
***************************************************************************
***RECEIPT OF GOVERNMENT ASSISTANCE
***Males
regress uireceipt ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo uireceipt
regress stimreceipt ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo stimreceipt
regress snapreceived ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo snapreceived
regress snapspend ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo snapspend
regress rent_help ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo rent_help
regress medicaid ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo medicaid
esttab using atable5.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(1.sexualitycat 3.sexualitycat) label                 ///
    title(Male Receipt of Government Assistance)       ///
   nonumbers mtitles("UI Receipt" "Stimulus Receipt" "SNAP Receipt" "SNAP Utilization" "Rent Help" "Medicaid") append
eststo clear
*means
svy: mean uireceipt if male==1
svy: mean stimreceipt if male==1
svy: mean snapreceived if male==1
svy: mean snapspend if male==1
svy: mean rent_help if male==1
svy: mean medicaid if male==1

***Females
regress uireceipt ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo uireceipt
regress stimreceipt ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo stimreceipt
regress snapreceived ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo snapreceived
regress snapspend ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo snapspend
regress rent_help ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo rent_help
regress medicaid ib2.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo medicaid
esttab using atable5.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(1.sexualitycat 3.sexualitycat) label                 ///
    title(Female Receipt of Government Assistance)       ///
   nonumbers mtitles("UI Receipt" "Stimulus Receipt" "SNAP Receipt" "SNAP Utilization" "Rent Help" "Medicaid") append
eststo clear
*means
svy: mean uireceipt if male==0
svy: mean stimreceipt if male==0
svy: mean snapreceived if male==0
svy: mean snapspend if male==0
svy: mean rent_help if male==0
svy: mean medicaid if male==0

***************************************************************************
**#   			  APPENDIX TABLE 6      			     ******************
***************************************************************************

***RECEIPT OF GOVERNMENT ASSISTANCE
***Males
regress uireceipt i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo uireceipt
regress stimreceipt i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo stimreceipt
regress snapreceived i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo snapreceived
regress snapspend i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo snapspend
regress rent_help i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo rent_help
regress medicaid i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==1, vce(robust)
eststo medicaid
esttab using atable6.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Male Receipt of Government Assistance)       ///
   nonumbers mtitles("UI Receipt" "Stimulus Receipt" "SNAP Receipt" "SNAP Utilization" "Rent Help" "Medicaid") append
eststo clear
*means
svy: mean uireceipt if male==1
svy: mean stimreceipt if male==1
svy: mean snapreceived if male==1
svy: mean snapspend if male==1
svy: mean rent_help if male==1
svy: mean medicaid if male==1

***Females
regress uireceipt i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo uireceipt
regress stimreceipt i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo stimreceipt
regress snapreceived i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo snapreceived
regress snapspend i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo snapspend
regress rent_help i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo rent_help
regress medicaid i.sexualitycat $demo_covariates $other_covariates $econ_covariates [pweight=pweight] if male==0, vce(robust)
eststo medicaid
esttab using atable6.csv, se star(* 0.10 ** 0.05 *** 0.01) keep(2.sexualitycat 3.sexualitycat) label                 ///
    title(Female Receipt of Government Assistance)       ///
   nonumbers mtitles("UI Receipt" "Stimulus Receipt" "SNAP Receipt" "SNAP Utilization" "Rent Help" "Medicaid") append
eststo clear
*means
svy: mean uireceipt if male==0
svy: mean stimreceipt if male==0
svy: mean snapreceived if male==0
svy: mean snapspend if male==0
svy: mean rent_help if male==0
svy: mean medicaid if male==0


***************************************************************************
**#   			    APPENDIX TABLE 7		     ******************
***************************************************************************
***RECEIPT OF GOVERNMENT ASSISTANCE
***Males
regsensitivity breakdown uireceipt gaylesbian $demo_covariates $other_covariates $econ_covariates, oster
scalar uireceipt_gay = e(breakfront)[1,2]
regsensitivity breakdown uireceipt bisexual $demo_covariates $other_covariates $econ_covariates, oster
scalar uireceipt_bi = e(breakfront)[1,2]
regsensitivity breakdown stimreceipt gaylesbian $demo_covariates $other_covariates $econ_covariates, oster
scalar stimreceipt_gay = e(breakfront)[1,2]
regsensitivity breakdown stimreceipt bisexual $demo_covariates $other_covariates $econ_covariates, oster
scalar stimreceipt_bi = e(breakfront)[1,2]
regsensitivity breakdown snapreceived gaylesbian $demo_covariates $other_covariates $econ_covariates, oster
scalar snapreceived_gay = e(breakfront)[1,2]
regsensitivity breakdown snapreceived bisexual $demo_covariates $other_covariates $econ_covariates, oster
scalar snapreceived_bi = e(breakfront)[1,2]
regsensitivity breakdown snapspend gaylesbian $demo_covariates $other_covariates $econ_covariates, oster
scalar snapspend_gay = e(breakfront)[1,2]
regsensitivity breakdown snapspend bisexual $demo_covariates $other_covariates $econ_covariates, oster
scalar snapspend_bi = e(breakfront)[1,2]
regsensitivity breakdown rent_help gaylesbian $demo_covariates $other_covariates $econ_covariates, oster
scalar rent_help_gay = e(breakfront)[1,2]
regsensitivity breakdown rent_help bisexual $demo_covariates $other_covariates $econ_covariates, oster
scalar rent_help_bi = e(breakfront)[1,2]
regsensitivity breakdown medicaid gaylesbian $demo_covariates $other_covariates $econ_covariates, oster
scalar medicaid_gay = e(breakfront)[1,2]
regsensitivity breakdown medicaid bisexual $demo_covariates $other_covariates $econ_covariates, oster
scalar medicaid_bi = e(breakfront)[1,2]

matrix define breakdown_points = (uireceipt_gay, stimreceipt_gay, snapreceived_gay, snapspend_gay, rent_help_gay,  medicaid_gay  \ uireceipt_bi, stimreceipt_bi, snapreceived_bi, snapspend_bi, rent_help_bi,  medicaid_bi)

putexcel set  atable7
putexcel A1=matrix(breakdown_points) 
putexcel save


***************************************************************************
**#   			    APPENDIX FIGURE 1		     ******************
***************************************************************************

use "$path\pulse2021_puf_34.dta", replace
gen wave = 34
append using "$path\pulse2021_puf_35.dta"
replace wave = 35 if wave==.
append using "$path\pulse2021_puf_36.dta"
replace wave = 36 if wave==.
append using "$path\pulse2021_puf_37.dta"
replace wave = 37 if wave==.
append using "$path\pulse2021_puf_38.dta"
replace wave = 38 if wave==.
append using "$path\pulse2021_puf_39.dta"
replace wave = 39 if wave==.
append using "$path\pulse2021_puf_40.dta"
replace wave = 40 if wave==.
append using "$path\pulse2022_puf_41.dta"
replace wave = 41 if wave==.
append using "$path\pulse2022_puf_42.dta"
replace wave = 42 if wave==.
append using "$path\pulse2022_puf_43.dta"
replace wave = 43 if wave==.

*Sexuality Categories
gen sexualitycat=.
replace sexualitycat = 1 if sexual_orientation==2
replace sexualitycat = 2 if sexual_orientation==1
replace sexualitycat = 3 if sexual_orientation==3
label define sexualitycat 1 "Heterosexual" 2 "Gay/lesbian" 3 "Bisexual"
label values sexualitycat sexualitycat
label var sexualitycat "Sexuality Categories"
tab sexualitycat

*Sex- No Missing
gen male = 0
replace male = 1 if egenid_birth==1

gen female = 0
replace female = 1 if egenid_birth==2

*Educational attainment
gen educat=.
replace educat = 1 if eeduc==1 | eeduc==2
replace educat = 2 if eeduc==3
replace educat = 3 if eeduc==4 | eeduc==5
replace educat = 4 if eeduc==6 | eeduc==7
label define educat 1 "Less than High School" 2 "High School Graduate" 3 "Some College" 4 "Bachelor's or higher"
label values educat educat
label var educat "Educational Attainment"
tab educat


*Differential Missingness to Income Question
gen income_missing=0 
replace income_missing=1 if income==.m
replace income_missing=1 if income==-99
tab income_missing sexualitycat if male==1, col
tab income_missing sexualitycat if female==1, col

label define income_missing 0 "Income Reported" 1 "Income Not Reported"
label values income_missing income_missing

*****Human Capital Differences for Income Missing- education distribution
tab educat, gen(educbin)
graph bar educbin*, over(income_missing) legend(label(1 "Less than High School") label(2 "High School Graduate") label(3 "Some College") label(4 "Bachelor's Degree or Higher")) stack
graph export afigure1.png, replace




